package thread;

public class ThreadInfoDemo {
    public static void main(String[] args) {
        //获取主线程
        Thread main = Thread.currentThread();
        //获取线程名字
        String name = main.getName();
        System.out.println("name:"+name);
        //id:唯一标识  使用该值可以唯一确定一个事物.
        // 可以作为唯一标识使用的值需要同时满足两个条件:非空且唯一
        long id = main.getId();
        System.out.println("id:"+id);

        boolean isAlive=main.isAlive();
        boolean isDaemon=main.isDaemon();
        boolean isInterrupted=main.isInterrupted();
        System.out.println(isAlive);
        System.out.println(isDaemon);
        System.out.println(isInterrupted);

        int priority=main.getPriority();
        System.out.println("优先级"+priority);
    }
}
